package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
//3、创建controller类
//本质就是一个普通类 通过SpringMVC提供的注解实现配置功能
@Controller("/user")
public class UserController {
    //4、使用RequestMapping注解 配置方法请求url
    @RequestMapping("/select.do")
    public ModelAndView select(ModelAndView mv,HttpServletRequest request){
        request.setAttribute("msg","查找返回的数据");
        mv.setViewName("/index.jsp");
        return mv;
    }

    @RequestMapping("/update.do")
    public String update(ModelAndView mv,HttpServletRequest request){
        request.setAttribute("msg","更新返回的数据");
        return "/index.jsp";
    }
}
